fathertoastfandomcom-20200214-history
Block Properties
This mod allows you to customize all blocks, vanilla or otherwise, with anything that can be modified through various events at your disposal and more. Many properties accept number ranges for values, and are randomized for each block event. Everything in this mod is completely configurable. This mod will do nothing if you do not edit its properties files. The properties files are generated in your .minecraft/config directory. The properties files use a format known as JSON (JavaScript Object Notation). You can find specs and examples of JSON on the JSON website and various tutorials scattered throughout the internet. This page will assume you understand JSON enough to write a file and know what I mean when I say "object", "array", "name", and "value". How To Use Install the mod and start Minecraft once to generate five files in your config folder: BlockProperties.cfg - the general properties for the mod. BlockProperties.json - the default properties to use when auto-generating new files. BlockProperties - the folder where all of your block properties files are stored. Should be full of auto-generated block properties at this point. BlockPropertiesExternal - the folder that houses all of your external functions. This will be covered more later. BlockPropertiesSchematics - the folder you place schematic files you wish to load and place in the game as block "drops". You probably won't need to mess with the general .cfg file. The few things inside are self-explanatory, so I won't be going over them here. Open up your BlockProperties folder (.minecraft/config/BlockProperties). You will see that the mod has already generated a file for each registered block - including any blocks from mods. The mod attempts to sort the properties by mod, but you may reorganize them however you want. You can open up JSON files with any text editor, or you can use any JSON or JavaScript program to help you write them. I recommend this online JSON editor to write your properties files with. It's simple, effective, free, and doesn't require a download. When you open up one of the generated properties files, you'll see it has six basic parts to it: "_name", "stats", "break_speed", "drops", "harvest", and "xp". The value of "_name" is the string id of the block the file will apply to. Only one file may exist for any string block id. "stats" is an object containing the base info about the block, such as hardness, light level, and sound type. This is not required, and anything left out defaults to the block's normal values. "break_speed", "drops", "harvest", and "xp" are the arrays which contain all of your function objects - they are also not required, and default to empty arrays if not included. Function objects are what alter the block's harvesting and drops. A function object is simply an object containing the field "function" with a value equal to the string name of the function you want to use, along with any required and optional name/value pairs associated with that function. Any function object can be used as an external function. It must be saved in its own .json file and placed in the subfolder of BlockPropertiesExternal that fits its context. For example, a function that adds a drop should go in BlockPropertiesExternal/drops. Throughout the tables below, you will see some fields say (number range). This means that those fields accept single numbers as numbers or strings, or two string numbers separated by a tilde (~). Any of these numbers may be represented as hexidecimal by prefixing the hex number with "0x". A number range will randomly be one of the two numbers, or any number in between. If a fractional number is used where an integer is needed, one of the two nearest integers is chosen at random, weighted towards the closer one (e.g., "0.3" has a 30% chance to be 1 and a 70% chance be be 0). All random decisions are made on a per-event basis (from above as used in "drops", "0.3" will be 1 for 30% of drops and 0 for the remaining 70% of drops). You may place a comment anywhere except in arrays. To do this, just make a string field called "_comment" and for its value, type whatever you want in quotations (e.g., "_comment":"This is a comment!"). Feel free to place multiple comments in one place -the overlapping of names will not matter because comments are ignored by the mod. Universal Functions These functions can be used anywhere that functions are accepted. Universal functions are generally logicals, conditionals, or loops. Quick Reference function: required_field* optional_field etc. all: functions* count choose: functions* count if_X: functions* count external: file* count conditionals: (* - does not work in "harvest") if_metadata_X* if_silk_touch if_above_fortune_X if_has_harvest_level_X if_can_harvest_X if_has_tool_level_X_Y if_check_nbt_X* if_on_ground if_burning if_wet if_submerged if_has_potion_X if_check_harvester_nbt_X if_raining if_thundering if_moon_phase_X if_beyond_X* if_difficulty_X if_past_world_difficulty_X if_past_day_time_X if_past_world_time_X if_in_dimension_X if_touching_block_X* if_below_X* if_in_biome_X* if_in_biome_type_X* if_biome_temp_X* if_biome_height_below_X* if_is_humid* if_rainfall_above_X* if_temp_above_X* if_biome_temp_above_X* if_broken_by_X if_player_online_X Full Table If Function The if_X function is a function which performs exactly like the all, but does not do anything at all if its condition is not met. The condition is determined by the name you use for the if_X function. Using an exclamation mark at the beginning of the function inverts its behavior, then only performing functions if its condition is NOT met. Some conditions require additional input, such as if_in_dimension_X, where you must replace the X'' with your input (in this case, an integer). Some conditions will always be false when used inside the "harvest" section. These are noted below with an asterisk before their condition. Functions: (* - does not work in "harvest") function: condition if_metadata_X: *if the block's metadata is X (varies from 0 to 15) if_silk_touch: if the harvester has the silk touch enchantment if_above_fortune_X: if the harvester has a fortune enchantment greater than X if_has_harvest_level_X: if the harvester's harvest level is greater than X (e.g., wood tools have level 0 and diamond tools have level 3) if_can_harvest_X: if the harvester can harvest block X (X is a string block id) if_has_tool_level_X_Y: if the harvester is using a tool of type X with at least harvest level Y (X is usually pickaxe, shovel, or axe; mods may add their own tool types) if_check_nbt_X: *if the nbt comparison is true (see below) if_on_ground: if the harvester is on the ground if_burning: if the harvester is on fire if_wet: if the harvester is in water (including rain/snow) if_submerged: if the harvester is under water and does not have aqua affinity if_has_potion_X: if the harvester has potion X on it (X is a potion name, usually potion.something) if_check_harvester_nbt_X: if the nbt comparison is true (see below) if_raining: if it is currently raining if_thundering: if there is currently a thunderstorm if_can_see_sky: *if the block has a direct view of the sky if_moon_phase_X: if the moon is currently in phase X (X is full, waning_gibbous, third_quarter, waning_crescent, new, waxing_crescent, first_quarter, or waxing_gibbous) if_beyond_X: *if the block is farther than X blocks from the world spawn point if_difficulty_X: if the difficulty is set to X (X is peaceful, easy, normal, or hard) if_past_world_difficulty_X: if the Apocalypse mod is installed, if the world difficulty is greater than X if_past_day_time_X: if the day time is greater than X (varies from 0 to 23999) if_past_world_time_X: if the total world time is greater than X if_in_dimension_X: if the block is in dimension X (X is an integer dimension id) if_touching_block_X: *if the block is adjacent to X (X is a string block id) if_below_X: *if the block is below layer X (X is an integer block height) if_in_biome_X: *if the mob is in biome X (X is a biome's name exactly as shown in F3) if_in_biome_type_X: *if the mob is in a biome similar to X (see below) if_biome_temp_X: *if the biome temperature is in the X category (X is cold, medium, or warm) temp ranges: (-0.5)- cold -(0.1)- invalid/cold -(0.2)- medium -(1.0)- hot -(2.0) if_biome_height_below_X: *if the biome's base height is below X blocks (see below for standard heights) if_is_humid: *if the biome is considered humid (normally rainfall > 0.85) if_rainfall_above_X: *if the biome's rainfall is greater than X if_temp_above_X: *if the temperature at the entity's location is above X (same as biome temp below 65 blocks, above 65 blocks decreses by a random amount, then -0.001667 for each block above 64) if_biome_temp_above_X: *if the biome's standard sea-level temperature is greater than X (water freezes below 0.2) if_broken_by_X: if the harvester's username is X if_player_online_X: if the player with username X is in the world if_check_nbt_X and if_check_harvester_nbt_X: For checking nbt tag values, X is the path of the tag, followed by , >, <, >=, or <=, and then by the value to compare to. String tags can only be compared using . For example, you want to check if the integer value called "Value", which is contained inside the "ForgeData" compound, is greater than or equal to 1 - you would use "if_check_nbt_ForgeData/Value>=1". Values and compounds in lists are represented by their index in that list (the first index is 0, then 1, and so on). For an example using a list, we can check if the harvester is below the y-level 16 by using "if_check_harvester_nbt_Pos/1<16" (in the "Pos" list, index 0 is the x position, index 1 is the y, and index 2 is the z). if_in_biome_type_X: The vanilla biome types are beach, desert, end, forest, hell, hills, jungle, mesa, mushroom, ocean, plains, river, savanna, snow, stone_beach, swamp, and taiga. Hills refers specifically to extreme hills, and hell is the Nether's biome. The type can also be the normal name of any biome in a type - this allows you to still use mod-added biomes and consider them as "types". if_biome_height_below_X: Sea level is at 64 blocks in default world generation. In addition to using normal y-values, you can also compare the biome height with the generic heights used by vanilla (e.g., "if_biome_height_below_default"). (y) name (6) deep_oceans (32) oceans (48) shallow_waters (57) partly_submerged (64) shores (67) rocky_waters (67) default (68) low_plains (70) mid_plains (70) low_islands (78) low_hills (96) mid_hills (112) high_plateaus Stats The stats section is very different from the others. Instead of an array of functions, stats is simply an object with many name:value pairs that define the blocks themselves. Stats are changed for all blocks as the game is loaded. When removing a field in stats, you will need to restart the game entirely in order to restore that value to its default (/bpreload will not reset defaults). No stats are required. Any stats that are not included in a block's properties file are not modified. Quick Reference field: value opacity: amount of light blocked (0-255; stone: 255, glass: 0, water: 3) brightness: level of light emitted (0-15; stone: 0, torch: 14, glowstone: 15) hardness: block hardness (0.0-Infinity, < 0.0 is unbreakable; stone: 1.5, torch: 0.0, bedrock: -1.0) resistance: explosion resistance (0.0-Infinity; stone: 30.0, torch: 0.0, bedrock: 1.8E7) sound: sounds made by the block (stone, wood, gravel, grass, piston, metal, glass, cloth, sand, snow, ladder, anvil; stone: piston (ironically, not stone), planks: wood) slipperiness: how much entities slide on top (0.0-Infinity, above about 1.02 it accelerates entities; stone: 0.6, ice: 0.98) tool_data: array of tool data objects (see below) fire_data: only used on minecraft:fire, array of fire data objects (see below) Tool Data Objects Tool data determines whether the mining speed for various tools can apply - it does not alter the ability to get drops from blocks (you must use the "harvest" or "drops" event for that). Each block is only capable of having a single tool and harvest level set per metadata value. Each tool data object contains three fields, none of which are required: field: value _meta: the metadata to apply the tool data to (-1-15; defaults to -1, which applies to all metadata) tool: a tool type that is allowed (usually pickaxe, shovel, or axe; defaults to the empty string, which removes the tool type; mods may add their own tool types) level: minimum harvest level of the tool type (-1 or higher; defaults to -1, which is no requirement) Fire Data Objects Fire data determines how flammable each block is to the fire block. This may not work for mod-added blocks, as mod authors can override the flammability and fire spread speed for their blocks. A fire block checks these values every 1.5 to 2 seconds, determining if any adjacent blocks should be destroyed or nearby air should be replaced by fire. When checking for destroying blocks, only those blocks directly adjacent to the fire block (blocks on fire) are checked. While checking for spreading the fire, air blocks in a 3x6x3 "column" around the fire are checked (up to 1 block down and to any side and up to 4 blocks above the fire); each air block's chance to become fire is determined by the highest fire spread value out of the blocks adjacent to it. Note that both fire destroying blocks and fire spreading are affected by several factors, and the maximum values given here are incredibly high because they take into account the absolute worst-cases. Each fire data object has three fields, only one of which is required: field: value _name:* the block to apply the fire data to (string block id, cannot be air; required) flammability: likelihood the block will be destroyed by an adjacent fire block (0-300; 0 is inflammable, 300 is assured destruction) spread: likelihood that fire will spread next to the block (0-35870; 0 is no chance, 8870 is assured spread in the 3x3x3 cube around the fire block, 35870 is assured spread) How certain factors affect the rate of fire spreading to and destroying blocks: fire block's age, humidity, position, +difficulty destroy: + above/below + spread: - - >1 block above - + Harvest Functions These functions (well actually, there is only one currently) can only be used in the "harvest" section. This is used to more easily force a block to require certain tools. Do NOT use any randomized values (e.g., number ranges) in the "harvest" section, this results in undefined behavior. Several ''if_X conditionals will also not work when used in this section, due to limited information in Forge's harvest check event (see the if function table for which conditionals fail). Quick Reference function: required_field* optional_field etc. set: value* Full Table Break Speed Functions These functions can only be used in the "break_speed" section. It is not recommended to use any randomized values (e.g., number ranges) here, as this is checked each tick while a player is mining. However, it will probably not explode the game if you want to. Quick Reference function: required_field* optional_field etc. set: value* add: value* mult: value* copy: id* data command: value* count suppress_output Full Table XP Functions These functions can only be used in the "xp" section. Use these to modify the amount of experience gained from breaking a block. If, for whatever reason, altering xp does not work on a block, you can at least add xp by using the "command" function (or drops function "spawn") to spawn in xp orbs. Quick Reference function: required_field* optional_field etc. set: value* add: value* mult: value* command: value* count suppress_output Full Table Drops Functions These functions can only be used in the "drops" section. Drops functions generally alter the items/things that blocks drop and are only performed when the block is broken. Quick Reference function: required_field* optional_field etc. default: value* add: id* damage count item_stats remove: id* damage count spawn: id* count tags mp_external set_block: id* data update x y z override tags schematic: file* update x y z override air_override command: value* count suppress_output Full Table Item Stats Functions These functions can be used in any array with the name "item_stats". Item stats functions alter item stacks by editing their nbt tag. Quick Reference function: required_field* optional_field etc. name: value* modifier: attribute* value* operator potion: id* amplifier duration ambient nbt: tags* enchant: id level lore: value* color: value Full Table Item Name Codes Include these anywhere in the value field of the name function to be replaced by randomized text. *''~c'' - Complete. Generates an entire name. If capitalized, it will base the name on one of the item's enchantments or modifiers (eventually - this is a WIP). *''~i'' - Info. Generates a name describing what the item is. Randomizes the name of the material and tool if they are not added by a mod. *''~p'' - Prefix. Generates an item prefix. If capitalized, it will base the name on one of the item's enchantments or modifiers (at least, it will - this is a WIP). *''~s'' - Postfix. Generates an item postfix. If capitalized, it will base the name on one of the item's enchantments or modifiers (at least, it will - this is a WIP). *''~d'' - Descriptor. Generates a describing word. Generally, you will want to precede this code with "NAME the ". *''~m'' - Mash. Generates a random name from the mash word generator. (Just jumbles up syllables.) *''~n'' - Normal. Generates a normal name from the list of pre-defined names. NBT Functions These functions can be used in any array with the name "tags". NBT functions represent NBT tags saved as an entity or item stack's tag compound. Using these, you can do just about anything. Make sure you know what you are doing when using these. Using the wrong data type or trying to put multiple data types in a tag list will crash your game and may even corrupt your world. For info on vanilla entities, see here. For items, see here. Use /bpreload to give yourself a stick that can convert nbt data of in-game entities and tile entities to an nbt function! Quick Reference function: required_field* optional_field etc. compound: name tags list: name tags : name value delete: name chest_loot: name loot inventory_size count item_id: name value* potion_id: name value* enchant_id: name value* types: string boolean byte byte_array short int int_array long float double Full Table Examples There's no way I could expect you to memorize all of the functions. If I were you, I would go to the quick reference section of each function section and copy/paste them all into a text document so you don't need to come back here and look through them. (Make sure you update it as new versions are released - the changelog will definitely tell you if any functions are added or implemented in an update!) The easiest way to get your own block properties started is by making a few files you like and copy/pasting them, altering them and adding on to them as you go. Anyway, let's get to the examples. I will assume you are using the recommended JSON editor. To read and understand these examples better, copy and paste them into the left side of the editor and hit the right arrow to load it into the right side of the page, then mess around with them as you like. It may be beneficial to you to keep your properties files open while testing them, so you can edit the files and use /bpreload from in game to test your changes immediately. Removing properties entirely from "stats" requires restarting your client to take effect, however. To be continued... Appendix Below are useful resources and information from other places compiled into one handy location. Yay! *Recommended JSON editor https://jsonformatter.org/json-editor *Vanilla item/block ids, item damage values, and block metadata http://minecraft.gamepedia.com/Data_values *Vanilla attributes http://minecraft.gamepedia.com/Attribute *Vanilla entity NBT format http://minecraft.gamepedia.com/Chunk_format#Entity_Format *Vanilla item NBT format http://minecraft.gamepedia.com/Player.dat_Format#Item_structure *Text formatting codes (use "\u00a7" for "§") http://minecraft.gamepedia.com/Formatting_codes Added Commands /bpreload - reloads all properties files /bpinfo - gives the player (optional) an info wand Vanilla Potion Ids Speed potion.moveSpeed Slowness potion.moveSlowdown Haste potion.digSpeed Mining Fatigue potion.digSlowDown Strength potion.damageBoost Weakness potion.weakness Instant Health potion.heal Instant Damage potion.harm Jump Boost potion.jump Nausea potion.confusion Regeneration potion.regeneration Resistance potion.resistance Fire Resistance potion.fireResistance Water Breathing potion.waterBreathing Invisibility potion.invisibility Blindness potion.blindness Night Vision potion.nightVision Hunger potion.hunger Poison potion.poison Wither potion.wither Health Boost potion.healthBoost Absorption potion.absorption Saturation potion.saturation Vanilla Enchantment Ids Sharpness enchantment.damage.all Smite enchantment.damage.undead Bane of Arthropods enchantment.damage.arthropods Knockback enchantment.knockback Fire Aspect enchantment.fire Protection enchantment.protect.all Fire Protection enchantment.protect.fire Feather Falling enchantment.protect.fall Blast Protection enchantment.protect.explosion Projectile Protection enchantment.protect.projectile Respiration enchantment.oxygen Aqua Affinity enchantment.waterWorker Efficiency enchantment.digging Silk Touch enchantment.untouching Unbreaking enchantment.durability Looting enchantment.lootBonus Fortune enchantment.lootBonusDigger Luck of the Sea enchantment.lootBonusFishing Lure enchantment.fishingSpeed Power enchantment.arrowDamage Flame enchantment.arrowFire Punch enchantment.arrowKnockback Infinity enchantment.arrowInfinite Thorns enchantment.thorns Category:Block Properties